Gio.DesktopAppInfo.set_desktop_env('GNOME');
- shellDBusService = new ShellDBus.GnomeShell();
- shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
-
sessionMode = new SessionMode.SessionMode();
- sessionMode.connect('sessions-loaded', _sessionsLoaded);
- sessionMode.init();
-}
-function _sessionsLoaded() {
- sessionMode.connect('updated', _sessionUpdated);
- _initializeUI();
- _sessionUpdated();
+ // start session after we know what mode we're running in
+ let signalId = sessionMode.connect('updated', function() {
+ sessionMode.disconnect(signalId);
+ startSession();
+ });
}
-function _initializeUI() {
+function startSession() {
+ shellDBusService = new ShellDBus.GnomeShell();
+ shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
+
// Ensure ShellWindowTracker and ShellAppUsage are initialized; this will
// also initialize ShellAppSystem first. ShellAppSystem
// needs to load all the .desktop files, and ShellWindowTracker
const SessionMode = new Lang.Class({
Name: 'SessionMode',
- init: function() {
+ _init: function() {
+ global.connect('notify::session-mode', Lang.bind(this, this._sync));
+ this._modes = _modes;
+ this._modeStack = [DEFAULT_MODE];
+ this._sync();
+
_getModes(Lang.bind(this, function(modes) {
this._modes = modes;
let primary = modes[global.session_mode] &&
let mode = primary ? global.session_mode : 'user';
this._modeStack = [mode];
this._sync();
-
- this.emit('sessions-loaded');
}));
},